package yf.mall.controller.api.app;


import com.yf.annotation.LoginUserId;
import com.yf.response.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import yf.mall.component.app.AppOrderComponent;
import yf.mall.vo.app.order.KolOrderDetailStatVo;
import yf.mall.vo.app.order.KolOrderDetailVo;
import yf.mall.vo.app.request.OrderDetailRequest;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/api/app/mini/order")
public class ApiAppOrderController extends ApiAppBaseController {

    @Resource
    private AppOrderComponent appOrderComponent;

    @RequestMapping(value = "/order-detail-stat",
            method = RequestMethod.POST)
    public R indexOrderDetailStat(@LoginUserId Long userId, @RequestBody OrderDetailRequest request) {
        KolOrderDetailStatVo orderDetailVo = appOrderComponent.calKolOrderDetailStat(userId, request);
        return dataResult(orderDetailVo);
    }

    @RequestMapping(value = "/order-detail",
            method = RequestMethod.POST)
    public R indexOrderDetail(@LoginUserId Long userId, @RequestBody OrderDetailRequest request) {
        KolOrderDetailVo orderDetailVo = appOrderComponent.orderDetail(userId,request);
        return dataResult(orderDetailVo);
    }
}
